<?php
namespace app\apishop\controller;
/**
 * Created by PhpStorm.
 * User: zhou
 * Date: 2018/3/15
 * Time: 11:09
 */

use think\Controller;
use think\Request;
use think\Db;

class Base extends Controller {
    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $post = request()->post();
        if(!empty($post['token'])){
            $supplier_id    = $post['supplier_id'];
            $token          = $post['token'];
            $type           = $post['type'];
            if($type == 'APP'){
                if($supplier_id != 0){
                    $supplier = Db::name('supplier')->where('id',$supplier_id)->find();
                    if($supplier['app_token'] != $token){
                        $msg['status'] = 990;
                        $msg['msg']    = '登录失效';
                        $msg['token'] = $supplier['app_token'];
                        echo json_encode($msg);exit;
                    }
                }
            }
        }
    }
}